import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import*
testCase="DBshop014_删除分类"
#调用自定义函数打开网页,url的值是在testData文件中定义的
firefox=openBrowser(url)
# 登录后台管理系统,地址是"http://localhost/dbshop/admin",
firefox.get(urlAdmin)
#调用自定义函数进行后台的登录
DBshopLoginAdmin(firefox)
#1.点击分类名称为“商品分类测试”后方的删除分类"链接
firefox.find_element_by_link_text("添加商品分类").click()
# firefox.find_element_by_xpath('//td[@class="icon-chevron-right"]/[2]').click()
firefox.find_element_by_xpath('//td[contains(.,"商品分类测试")]/following-sibling::td[4]/a[3]').click()
firefox.switch_to_alert().accept()
time.sleep(3)
try:
    firefox.find_element_by_xpath("//td[contains(.,'商品分类测试')]")
    writeLog("%s 测试失败"%testCase)
except:
    writeLog("%s 测试成功" % testCase)
    getPhoto(firefox)
firefox.quit()
